package by.bsu.touragency.command.guest;

import java.util.ArrayList;
import org.apache.log4j.Logger;
import by.bsu.touragency.db.beans.Tour;
import by.bsu.touragency.db.dao.TourDAO;

public class AllNBToursLogic {
	private static Logger logger = Logger.getLogger("log");

	public static boolean checkSearch(String text) {
		logger.debug("cheking search request");
		return true;
	}

	public static ArrayList<Tour> getTours() {
		TourDAO t = new TourDAO();
		return t.readNB();
	}

	public int getTourPrice() {
		TourDAO t = new TourDAO();
		return t.readNB().get(0).getPrice();
	}

	public String getTourPlace() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getHotel().getName() + ", ";
		str += t.readNB().get(0).getHotel().getCity().getCityName() + ", ";
		str += t.readNB().get(0).getHotel().getCity().getCountry()
				.getCountryName();
		return str;
	}

	public String getTourPeople() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getHotel().getPeople().getChildren()
				+ "children & ";
		str += t.readNB().get(0).getHotel().getPeople().getAdults() + " adults";
		return str;
	}

	public String getTourEat() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getHotel().getEat().getType() + ": ";
		str += t.readNB().get(0).getHotel().getEat().getAbout();
		return str;
	}

	public String getTourHotel() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getHotel().getName() + " ";
		str += t.readNB().get(0).getHotel().getStar().getName() + " (";
		str += t.readNB().get(0).getHotel().getStar().getAbout() + ") .";
		str = t.readNB().get(0).getHotel().getAbout();
		return str;
	}

	public String getTourCountry() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getHotel().getCity().getCountry()
				.getCountryName()
				+ ". ";
		str += t.readNB().get(0).getHotel().getCity().getCountry().getAbout();
		return str;
	}

	public String getTourCity() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getHotel().getCity().getCityName() + ". ";
		str += t.readNB().get(0).getHotel().getCity().getAbout();
		return str;
	}

	public String getTourTransfer() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getTransfer().getDateFrom() + " ";
		str += t.readNB().get(0).getTransfer().getDateTo();
		return str;
	}

	public String getTourTransport() {
		TourDAO t = new TourDAO();

		String str;
		str = t.readNB().get(0).getTransport().getView().getName() + "  ";
		str = t.readNB().get(0).getTransport().getView().getNumber() + "."
				+ "\n";
		str += t.readNB().get(0).getTransport().getDateFrom() + " - ";
		str += t.readNB().get(0).getTransport().getCityFrom() + "\n";
		str += t.readNB().get(0).getTransport().getDateTo() + " - ";
		str += t.readNB().get(0).getTransport().getCityTo() + ". ";
		return str;
	}

	public String getTourDates() {
		TourDAO t = new TourDAO();
		String str;
		str = t.readNB().get(0).getDateFrom().getTime() + " - ";
		str += t.readNB().get(0).getDateTo().getTime() + ".";
		return str;
	}
}
